package at.fhj.swd10.eshop.web.view;

import at.fhj.swd10.eshop.domain.Product;
import at.fhj.swd10.eshop.web.application.ShopData;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

/**
 * @author David
 */
@ManagedBean
@ViewScoped
public class InsertProductBacking implements Serializable {

    @ManagedProperty(value = "#{shopData}")
    private ShopData shopData;
    private Product product = new Product();

    public String insertProduct() throws Exception {
        shopData.insertProduct(product);
        return "productOverview";
    }

    public ShopData getShopData() {
        return shopData;
    }

    public void setShopData(ShopData shopData) {
        this.shopData = shopData;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
}
